import request from '@/utils/request';

export async function getUsers(params) {
  return request(
    `/api/users?name=${params.name}&page=${params.pager.limit}&size=${params.pager.offset}`,
  );
}

export async function getUser(userId) {
  return request(`/api/user?id=${userId}`, { method: 'GET' });
}

export async function DeleteUser(userId) {
  return request(`/api/user?id=${userId}`, { method: 'DELETE' });
}

export async function AddUser(user) {
  return request('/api/user', {
    method: 'POST',
    data: user,
  });
}

export async function EditUser(user) {
  return request('/api/user', {
    method: 'PUT',
    data: user,
  });
}
